﻿using System;
using System.Globalization
;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using SQLExecute;

public partial class info_phepnam : System.Web.UI.Page
{
    DataSet ds;
    CultureInfo culture;
    DateTimeStyles styles = DateTimeStyles.None;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            if (Session["username"] != null)
            {

                lFullName.Text = Session["fullname"].ToString();
                lUsername.Text = Session["username"].ToString();
                Get_Nghi_Theo_YC_CTY();
            }
            else Response.Redirect("login.aspx");

    }

    protected void lnkLogout_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("login.aspx");
    }

    protected void Get_Nghi_Theo_YC_CTY()
    {

      double total = 0.0;  
      DateTime dt;
      DateTime.TryParse(Session["ngaynhanviec"].ToString(), culture, styles, out dt);
      User u = new User();
      NghiPhep n=new NghiPhep();
      culture = CultureInfo.CreateSpecificCulture("fr-FR");

      string email = Session["email"].ToString();
      n = n.Get_Nghi_Phep_Info(email); 
      n._tongphepnam = u.Get_Phep_Nam_Duoc_Huong(dt);
      total = n.Get_Nghi_Theo_YC_CTY();
      lTongSoPhepNam.Text = (n._tongphepnam - total).ToString();
       

    }
}
